function [x,y,typ]=synSerial2Bus_int(job,arg1,arg2)
x=[];y=[],typ=[]
select job
case 'plot' then
  standard_draw(arg1)
case 'getinputs' then
  [x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
  [x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
  [x,y]=standard_origin(arg1)
case 'set' then
  y=needcompile
  while %t do
    [x,newparameters,needcompile]=scicos(arg1.model.rpar)
    arg1.model.rpar=x
    [ok,arg1]=adjust_s_ports(arg1)
    if ok then
      x=arg1
      y=needcompile
      typ=newparameters
      %exit=resume(%f)
    else
      %r=2
      %r=message(['SUPER BLOCK needs to be edited;';'Edit or exit by removing all edition'],['Edit';'Exit'])
      if %r==2 then typ=list(),%exit=resume(%t),end
    end
  end
case 'define' then
scs_m_1=scicos_diagram(..
        version="scicos4.2",..
        props=scicos_params(..
              wpar=[-57.181169,554.92691,116.79163,905.40956,834,1075,68,209,714,672,246,0,1.4],..
              Title=["synSerial2Bus_int",..
              "C:/Documents and Settings/Administrator/My Documents/scicos_work/scicom/palettes/"],..
              tol=[0.0001,0.000001,1.000D-10,100001,0,0],..
              tf=100000,..
              context=" ",..
              void1=[],..
              options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
              list([5,1],[4,1]),[0.8,0.8,0.8]),..
              void2=[],..
              void3=[],..
              doc=list()))
scs_m_1.objs(1)=scicos_block(..
                gui="CONVSP_f",..
                graphics=scicos_graphics(..
                         orig=[143.55958,338.48642],..
                         sz=[40,40],..
                         flip=%t,..
                         theta=0,..
                         exprs=["64";"0"],..
                         pin=4,..
                         pout=6,..
                         pein=12,..
                         peout=[],..
                         gr_i=list(..
                         ["txt=[''Serial to Bus'';''Converter''];";
                         "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),..
                         id="",..
                         in_implicit="E",..
                         out_implicit="E"),..
                model=scicos_model(..
                         sim=list("convsp",2),..
                         in=1,..
                         in2=[],..
                         intyp=1,..
                         out=64,..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=[],..
                         state=[],..
                         dstate=[0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;
                         0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=[],..
                         opar=list(),..
                         blocktype="d",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_2=scicos_diagram(..
        version="scicos4.2",..
        props=scicos_params(..
              wpar=[600,450,0,0,600,450],..
              Title="freq_div",..
              tol=[0.0001,0.000001,1.000D-10,100001,0,0],..
              tf=100000,..
              context=" ",..
              void1=[],..
              options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(%t,33),[8,1],[1,5],..
              list([5,1],[4,1]),[0.8,0.8,0.8]),..
              void2=[],..
              void3=[],..
              doc=list()))
scs_m_2.objs(1)=scicos_block(..
                gui="Modulo_Count",..
                graphics=scicos_graphics(..
                         orig=[60.518363,178.33333],..
                         sz=[60,40],..
                         flip=%t,..
                         theta=0,..
                         exprs=["0";"64"],..
                         pin=[],..
                         pout=7,..
                         pein=10,..
                         peout=[],..
                         gr_i=list(..
                         "xstringb(orig(1),orig(2),[''  Counter'';''Modulo ''+string(base)],sz(1),sz(2),''fill'');",..
                         8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit="E"),..
                model=scicos_model(..
                         sim=list("modulo_count",4),..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=1,..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=[],..
                         state=[],..
                         dstate=0,..
                         odstate=list(),..
                         rpar=[],..
                         ipar=64,..
                         opar=list(),..
                         blocktype="c",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_2.objs(2)=scicos_block(..
                gui="CLKINV_f",..
                graphics=scicos_graphics(..
                         orig=[215.37648,299.81481],..
                         sz=[20,30],..
                         flip=%t,..
                         theta=0,..
                         exprs="1",..
                         pin=[],..
                         pout=[],..
                         pein=[],..
                         peout=6,..
                         gr_i=list(..
                         ["xo=orig(1);yo=orig(2)+sz(2)/3";"xstringb(xo,yo,string(prt),sz(1),sz(2)/1.5)"],..
                         8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="input",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=[],..
                         evtout=1,..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=1,..
                         opar=list(),..
                         blocktype="d",..
                         firing=-1,..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_2.objs(3)=scicos_block(..
                gui="CLKOUTV_f",..
                graphics=scicos_graphics(..
                         orig=[221.30407,86.481481],..
                         sz=[20,30],..
                         flip=%t,..
                         theta=0,..
                         exprs="1",..
                         pin=[],..
                         pout=[],..
                         pein=5,..
                         peout=[],..
                         gr_i=list(" ",8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="output",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=[],..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=1,..
                         opar=list(),..
                         blocktype="d",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_2.objs(4)=scicos_block(..
                gui="IFTHEL_f",..
                graphics=scicos_graphics(..
                         orig=[193.14804,168.7037],..
                         sz=[60,60],..
                         flip=%t,..
                         theta=0,..
                         exprs=["1";"0"],..
                         pin=7,..
                         pout=[],..
                         pein=9,..
                         peout=[0;5],..
                         gr_i=list(..
                         ["txt=[''If in>0'';'' '';'' then    else''];";
                         "xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');"],8),..
                         id="",..
                         in_implicit="E",..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim=list("ifthel",-1),..
                         in=1,..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=[1;1],..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=[],..
                         opar=list(),..
                         blocktype="l",..
                         firing=[-1,-1],..
                         dep_ut=[%t,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_2.objs(5)=scicos_link(..
                  xx=[233.14804;231.30407],..
                  yy=[162.98942;116.48148],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[5,-1],..
                  from=[4,2,0],..
                  to=[3,1,1])
scs_m_2.objs(6)=scicos_link(..
                  xx=[225.37648;224.29194],..
                  yy=[299.81481;267.98739],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[5,-1],..
                  from=[2,1,0],..
                  to=[8,1,1])
scs_m_2.objs(7)=scicos_link(..
                  xx=[129.08979;184.57662],..
                  yy=[198.33333;198.7037],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[1,1],..
                  from=[1,1,0],..
                  to=[4,1,1])
scs_m_2.objs(8)=scicos_block(..
                gui="CLKSPLIT_f",..
                graphics=scicos_graphics(..
                         orig=[224.29194;267.98739],..
                         sz=[0.3333333,0.3333333],..
                         flip=%t,..
                         theta=0,..
                         exprs=[],..
                         pin=[],..
                         pout=[],..
                         pein=6,..
                         peout=[9;10],..
                         gr_i=list([],8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="split",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=[1;1],..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=[],..
                         opar=list(),..
                         blocktype="d",..
                         firing=[%f,%f,%f],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_2.objs(9)=scicos_link(..
                  xx=[224.29194;223.14804],..
                  yy=[267.98739;234.41799],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[5,-1],..
                  from=[8,1,0],..
                  to=[4,1,1])
scs_m_2.objs(10)=scicos_link(..
                   xx=[224.29194;90.518363;90.518363],..
                   yy=[267.98739;267.98739;224.04762],..
                   id="drawlink",..
                   thick=[0,0],..
                   ct=[5,-1],..
                   from=[8,2,0],..
                   to=[1,1,1])
scs_m_1.objs(2)=scicos_block(..
                gui="freq_div",..
                graphics=scicos_graphics(..
                         orig=[214.73635,338.45841],..
                         sz=[40,40],..
                         flip=%t,..
                         theta=0,..
                         exprs=[],..
                         pin=[],..
                         pout=[],..
                         pein=13,..
                         peout=10,..
                         gr_i=list("xstringb(orig(1),orig(2),''freq_div'',sz(1),sz(2),''fill'')",8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="csuper",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=1,..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=scs_m_2,..
                         ipar=[],..
                         opar=list(),..
                         blocktype="h",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_1.objs(3)=scicos_block(..
                gui="IN_f",..
                graphics=scicos_graphics(..
                         orig=[94.988152,348.48642],..
                         sz=[20,20],..
                         flip=%t,..
                         theta=0,..
                         exprs="1",..
                         pin=[],..
                         pout=4,..
                         pein=[],..
                         peout=[],..
                         gr_i=list(" ",8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit="E"),..
                model=scicos_model(..
                         sim="input",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=-1,..
                         out2=-2,..
                         outtyp=-1,..
                         evtin=[],..
                         evtout=[],..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=1,..
                         opar=list(),..
                         blocktype="c",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_1.objs(4)=scicos_link(..
                  xx=[114.98815;134.98815],..
                  yy=[358.48642;358.48642],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[1,1],..
                  from=[3,1,0],..
                  to=[1,1,1])
scs_m_1.objs(5)=scicos_block(..
                gui="OUT_f",..
                graphics=scicos_graphics(..
                         orig=[333.23153,349.95362],..
                         sz=[20,20],..
                         flip=%t,..
                         theta=0,..
                         exprs="1",..
                         pin=6,..
                         pout=[],..
                         pein=[],..
                         peout=[],..
                         gr_i=list(" ",8),..
                         id="",..
                         in_implicit="E",..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="output",..
                         in=-1,..
                         in2=-2,..
                         intyp=-1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=[],..
                         evtout=[],..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=1,..
                         opar=list(),..
                         blocktype="c",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_1.objs(6)=scicos_link(..
                  xx=[192.13101;333.23153],..
                  yy=[358.48642;359.95362],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[1,1],..
                  from=[1,1,0],..
                  to=[5,1,1])
scs_m_1.objs(7)=scicos_block(..
                gui="CLKINV_f",..
                graphics=scicos_graphics(..
                         orig=[151.35775,487.56052],..
                         sz=[20,30],..
                         flip=%t,..
                         theta=0,..
                         exprs="1",..
                         pin=[],..
                         pout=[],..
                         pein=[],..
                         peout=8,..
                         gr_i=list(..
                         ["xo=orig(1);yo=orig(2)+sz(2)/3";"xstringb(xo,yo,string(prt),sz(1),sz(2)/1.5)"],..
                         8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="input",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=[],..
                         evtout=1,..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=1,..
                         opar=list(),..
                         blocktype="d",..
                         firing=-1,..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_1.objs(8)=scicos_link(..
                  xx=[161.35775;162.55108],..
                  yy=[487.56052;431.54251],..
                  id="drawlink",..
                  thick=[0,0],..
                  ct=[5,-1],..
                  from=[7,1,0],..
                  to=[11,1,1])
scs_m_1.objs(9)=scicos_block(..
                gui="CLKOUTV_f",..
                graphics=scicos_graphics(..
                         orig=[224.0024,264.67455],..
                         sz=[20,30],..
                         flip=%t,..
                         theta=0,..
                         exprs="1",..
                         pin=[],..
                         pout=[],..
                         pein=10,..
                         peout=[],..
                         gr_i=list(" ",8),..
                         id="",..
                         in_implicit=[],..
                         out_implicit=[]),..
                model=scicos_model(..
                         sim="output",..
                         in=[],..
                         in2=[],..
                         intyp=1,..
                         out=[],..
                         out2=[],..
                         outtyp=1,..
                         evtin=1,..
                         evtout=[],..
                         state=[],..
                         dstate=[],..
                         odstate=list(),..
                         rpar=[],..
                         ipar=1,..
                         opar=list(),..
                         blocktype="d",..
                         firing=[],..
                         dep_ut=[%f,%f],..
                         label="",..
                         nzcross=0,..
                         nmode=0,..
                         equations=list()),..
                doc=list())
scs_m_1.objs(10)=scicos_link(..
                   xx=[234.73635;234.0024],..
                   yy=[332.74412;294.67455],..
                   id="drawlink",..
                   thick=[0,0],..
                   ct=[5,-1],..
                   from=[2,1,0],..
                   to=[9,1,1])
scs_m_1.objs(11)=scicos_block(..
                 gui="CLKSPLIT_f",..
                 graphics=scicos_graphics(..
                          orig=[162.55108;431.54251],..
                          sz=[0.3333333,0.3333333],..
                          flip=%t,..
                          theta=0,..
                          exprs=[],..
                          pin=[],..
                          pout=[],..
                          pein=8,..
                          peout=[12;13],..
                          gr_i=list([],8),..
                          id="",..
                          in_implicit=[],..
                          out_implicit=[]),..
                 model=scicos_model(..
                          sim="split",..
                          in=[],..
                          in2=[],..
                          intyp=1,..
                          out=[],..
                          out2=[],..
                          outtyp=1,..
                          evtin=1,..
                          evtout=[1;1],..
                          state=[],..
                          dstate=[],..
                          odstate=list(),..
                          rpar=[],..
                          ipar=[],..
                          opar=list(),..
                          blocktype="d",..
                          firing=[%f,%f,%f],..
                          dep_ut=[%f,%f],..
                          label="",..
                          nzcross=0,..
                          nmode=0,..
                          equations=list()),..
                 doc=list())
scs_m_1.objs(12)=scicos_link(..
                   xx=[162.55108;163.55958],..
                   yy=[431.54251;384.20071],..
                   id="drawlink",..
                   thick=[0,0],..
                   ct=[5,-1],..
                   from=[11,1,0],..
                   to=[1,1,1])
scs_m_1.objs(13)=scicos_link(..
                   xx=[162.55108;234.73635;234.73635],..
                   yy=[431.54251;431.54251;384.1727],..
                   id="drawlink",..
                   thick=[0,0],..
                   ct=[5,-1],..
                   from=[11,2,0],..
                   to=[2,1,1])
model=scicos_model(..
         sim="super",..
         in=-1,..
         in2=[],..
         intyp=1,..
         out=-1,..
         out2=[],..
         outtyp=1,..
         evtin=1,..
         evtout=1,..
         state=[],..
         dstate=[],..
         odstate=list(),..
         rpar=scs_m_1,..
         ipar=[],..
         opar=list(),..
         blocktype="h",..
         firing=[],..
         dep_ut=[%f,%f],..
         label="",..
         nzcross=0,..
         nmode=0,..
         equations=list())
  gr_i='xstringb(orig(1),orig(2),''synSerial2Bus_int'',sz(1),sz(2),''fill'')';
  x=standard_define([2 2],model,[],gr_i)
end
endfunction
